 <extend name="Index:basic" />

 <block name="title"><title>我爱预约网商户页面</title></block>
  <block name="files">
  <link href="__ROOT__/Application/Home/View/Public/Css/Shop/shop.css" rel="stylesheet" type="text/css" />   

  <script src='__ROOT__/Application/Home/View/Public/Js/Shop/shop.js'></script>

       <script type="text/javascript">
        function convert(rows){
            function exists(rows, pid){
                for(var i=0; i<rows.length; i++){
                    if (rows[i].id == pid) return true;
                }
                return false;
            }
            
            var nodes = [];
            // get the top level nodes
            for(var i=0; i<rows.length; i++){
                var row = rows[i];
                if (!exists(rows, row.pid)){
                    nodes.push({
                        id:row.id,
                        text:row.name
                    });
                }
            }
            
            var toDo = [];
            for(var i=0; i<nodes.length; i++){
                toDo.push(nodes[i]);
            }
            while(toDo.length){
                var node = toDo.shift();    // the parent node
                // get the children nodes
                for(var i=0; i<rows.length; i++){
                    var row = rows[i];
                    if (row.pid == node.id){
                        var child = {id:row.id,text:row.name};
                        if (node.children){
                            node.children.push(child);
                        } else {
                            node.children = [child];
                        }
                        toDo.push(child);
                    }
                }
            }
            return nodes;
        }
        
        $(function(){
            $('#tt').tree({
                url: '{:U('Shop/tree')}',
                loadFilter: function(rows){
                    return convert(rows);
                }
            });
        });

        $(function(){
          // $('#tt').tree({
          //   onClick: function(node){
          //     $(this).tree('toggle', node.target);

          //   }
          // });

            // $('#tt').tree({  
            //             checkbox: false,  
            //             dnd:true,  
            //             url: webContext+"/menu/getTemplateMenuItemChild.do?id=0",  
            //             onClick:function(node){//单击事件  
            //                 $(this).tree('toggle', node.target);  
            //             }  
            //         }  
             // $('#tt').tabs('add',{
             //    title: 'Tab'+index,
             //    closable: true,
             //    href:'tabposition.html' // url
             //    });
             var _tabPanel=$("#menucontent");


            $('#tt').tree({ 
              onClick: function(node){ 
                  if($('#tt').tree('isLeaf',node.target)){

                    // alert(1); 
                    // alert(node.id);
                    var nodeid=node.id;
                    // alert(nodeid);

                    var url="__APP__/Home/Shop/shopmenusearch/"+'id/'+'{$id}'+'/nodeid/'+nodeid;
                    // U('Blog/cate',array('cate_id'=>1,'status'=>1))
                    var title=node.text;
                    // alert(node.text);
                    // alert(url);
                    // alert(title);

                     if(url!=="#"&&url!==""){
                       // alert(2);
                      if(!_tabPanel.tabs('exists',title)){
                        // alert(3);
                          _tabPanel.tabs('add',{
                                             title:title,
                                             content:'<iframe src="'+url+'" style="padding:0;margin:0;border:0;width:100%;height:100%;"></iframe>',
                                             closable:true});
                          bindfresh(title);
                    }else{
                      // alert(5);
                      _tabPanel.tabs('select',title);
                    }
                  }
                    
                      
                } 
              } 
            });
            window.document.addTab=function(url,title){
                  var _tabPanel=$("#menucontent");
                  if(!_tabPanel.tabs('exists',title)){
                  _tabPanel.tabs('add',{
                    title:title,
                    content:'<iframe src="'+url+'" style="padding:0;margin:0;border:0;width:100%;height:100%;"></iframe>',
                    closable:true});
                bindfresh(title);
                  }else{
                _tabPanel.tabs('select',title);
                  }
            }//end window.document.addTab


             function wopen(url){window.open (url,'newwindow','height=800,width=1100,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')}
              function bindfresh(title){
              /*双击刷新TAB选项卡*/
                $(".tabs-inner").dblclick(function(){
                    var _ctab=$('#main').tabs('getTab',title);
                    var html=_ctab.html();
                    _ctab.html(html);
                });//end $(".tabs-inner").dblclick
              }

        });

</script>

  </block>  

  <block name='content'>

    <div class="row">

      <ol class="col-md-12 breadcrumb text-left">
        <li><a href="{:U('Index/Index')}">首页</a></li>
        <li><a href="#">美食</a></li>
        <li class="active">商家</li>
      </ol>

 <!--店铺简介-->
      <div class="col-md-9 shop_info">
        <div class="col-md-4 shop_album">
          <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                <!-- Indicators -->
                <ol class="carousel-indicators">
                   <if condition="$ispic eq 1 "> 
                      <volist name='shop_pics' id='vo'>
                          <if condition="$key eq 0">
                            <li data-target="#carousel-example-generic" data-slide-to="$key" class="active"></li>
                          <else/>
                            <li data-target="#carousel-example-generic" data-slide-to="$key"></li>

                          </if>                          
                      </volist>                                  

                    <else />
                          <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                          <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                          <li data-target="#carousel-example-generic" data-slide-to="2"></li>                         
                    </if> 

                 
                </ol>

                <!-- Wrapper for slides -->
                <div class="carousel-inner" role="listbox"> 
                   <if condition="$ispic eq 1 "> 
                      <volist name='shop_pics' id='vo'>
                          <if condition="$key eq 0">
                            <div class="item active">
                              <img src="__ROOT__{$vo.shop_pic_path}{$vo.shop_pic_name}">
                              <div class="carousel-caption">                      
                                 <h3>图片标题</h3>
                                 <p>说明</p>
                              </div>
                            </div>
                          <else/>
                          <div class="item">
                              <img src="__ROOT__{$vo.shop_pic_path}{$vo.shop_pic_name}">
                              <div class="carousel-caption">
                                  <h3>图片标题</h3>
                                  <p>说明</p>
                              </div>
                          </div> 

                          </if>                          
                         </volist>                                  

                    <else />
                         <div class="item active">
                            <img src="holder.js/200x200">
                            <div class="carousel-caption">                      
                               <h3>没有图片</h3>
                               <p>欢迎上传</p>
                            </div>
                          </div>
                          <div class="item">
                              <img src="holder.js/200x200">
                              <div class="carousel-caption">
                                     <h3>上传图片</h3>
                                     <p>获得积分</p>
                              </div>
                          </div> 
                           <div class="item">
                              <img src="holder.js/200x200">
                              <div class="carousel-caption">
                                     <h3>上传图片</h3>
                                     <p>获得积分</p>
                              </div>
                          </div>  
                            
                    </if>                         
                 
                </div>

                <!-- Controls -->
                <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                  <span class="sr-only">Previous</span>
                </a>
                <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                  <span class="sr-only">Next</span>
                </a>
              </div>
              <a href="{:U('Shop/addshoppic',array('id'=>$id))}" class="btn btn-success" role="button">为商铺添加图片</a>



        </div>
        <div class="col-md-8 shop_info_text">
            <div class="col-md-2">
              <img src="holder.js/20x20">                
            </div>
            <div class="col-md-10">
            <h4 class="pull-left">{$shop_name}</h4>
            <img src="holder.js/10x10">
            <img src="holder.js/10x10">
            <img src="holder.js/10x10">
            <a href="###">收藏店铺</a>
            </div>

          <p>{$shop_introduction|htmlspecialchars_decode= ###}</p>

              <div class="col-md-8">
                <div class="col-md-12"><strong>总评：{$shop_service_satisfaction}</strong></div>
                <div class="col-md-12"><strong>人均消费：{$shop_average_spend}环境：{$shop_environment}服务:{$shop_service}</strong></div>
                <div class="col-md-12"><strong>电话：{$shop_telephone}营业时间：{$shop_open_time}</strong></div>
                <div class="col-md-12">
                  <img src="holder.js/20x20">
                  <img src="holder.js/20x20">
                  <img src="holder.js/20x20">
                </div>
               
              </div>
              <div class="col-md-4 shop_user_remark">
                <div class="col-md-12"><strong>总评：{$shop_service_satisfaction}</strong></div>
                <div class="col-md-12"><strong>{$shop_feedback_rate}用户推荐</strong></div>
                <div class="col-md-12"><strong>{$shop_remark_num}个用户点评</strong></div>
              </div>

              <div class="col-md-10">
              <a href="#" class="btn btn-success active" role="button">预约</a>
              <a href="#" class="btn btn-success active" role="button">外卖</a>
              <a href="#" class="btn btn-success active" role="button">团购</a>
              <a href="#" class="btn btn-success active" role="button">我来点评</a>
              </div>
        </div>

        </div>
 <!--地图-->
      <div class="col-md-3 shop_map">
        <img src="holder.js/203x240">
      </div>

 <!--店铺详细信息-->
      <div class="col-md-9 shop_details">
        <div id="tab">
            <ul class="tab_menu">
                <li class="selected">餐厅详情</li>
                  <li>餐桌</li>
                  <li>菜单</li>
                  <li>外卖</li>
                  <li>团购</li>
                  <li>订单记录</li>
                  <li>餐厅点评</li> 
              </ul>
              <div class="tab_box">
                  <div>
                      {$shop_details|htmlspecialchars_decode= ###}
                      <a href="{:U('Shop/addshopdetail',array('id'=>$id))}" class="btn btn-success" role="button">更新详细信息</a>
                  </div>

                  <div style="display:none">
                    <a href="{:U('shopcenter',array('id'=>$id))}" class="btn btn-success" role="button">更新餐桌详细细信息</a>
                  </div>
                  <div style="display:none">

                    <div class="row">
                      <div class="col-md-2">
                        <ul id="tt"></ul>

                      </div>
                      

                      <div id="menucontent" class="easyui-tabs col-md-10">

                        <div title="全部菜单项" style="padding:10px;">
                          <iframe  frameborder="0" style="padding:0;margin:0;border:0;width:100%;height:100%;" src="{:U('Shop/shopmenusearch',array('id'=>$id))}"></iframe>
                        </div>

                        
                      </div>
                    </div> 
                    <div class='row'>
                       <a href="{:U('shopcenter',array('id'=>$id))}" class="btn btn-success" role="button">更新菜单详细细信息</a>
                      
                    </div> 
                  </div>
                  <div style="display:none">
                    <a href="{:U('Shop/addshopdetail',array('id'=>$id))}" class="btn btn-success" role="button">更新外卖详细细信息</a>
                  </div>
                  <div style="display:none">团购的内容</div>
                  <div style="display:none">订单的记录</div>
                  <div style="display:none">点评的内容</div>
              </div>
        </div>
        店铺详细信息
      </div>
  <!--电话，地图和优惠信息-->
      <div class="col-md-3 shop_tel_order_preferential">
        <div class="col-md-12 shop_tel">
        <span>预约电话1：{$shop_telephone}</span>
        <span>预约电话2：{$shop_phone}</span>
        <span>地址：{$shop_address}</span>
        

        </div>
        <div class="col-md-12 shop_order">
        订单
        

        </div>
        <div class="col-md-12 shop_preferential">
        优惠信息
        

        </div>


      </div>


    </div>

  </block>
